@use 'sass:math';

@import '@devui/theme/styles-var/devui-var.scss';

$simple-step-height: 36;
$simple-step-space: 8;

.#{$devui-prefix}-steps {
  display: flex;

  &.vertical {
    flex-direction: column;
    height: 100%;

    .#{$devui-prefix}-step {
      flex-direction: row;

      &__line {
        width: 1px;
        height: 100%;
        left: 12px;
        top: 24px;
      }

      &__content {
        margin-left: 8px;
        padding-top: 2px;
      }
    }
  }

  &.simple {
    .#{$devui-prefix}-step {
      position: relative;
      height: #{$simple-step-height}px;
      line-height: #{$simple-step-height}px;
      text-align: center;
      background-color: $devui-brand-foil;
      color: $devui-text;

      &:not(:first-child) {
        margin-left: #{math.div($simple-step-height, 2)}px;
      }

      &:not(:last-child) {
        margin-right: #{math.div($simple-step-height, 2)}px;
      }

      &:not(:first-child)::before {
        content: '';
        width: 0;
        height: 0;
        position: absolute;
        left: -#{$simple-step-height - $simple-step-space}px;
        top: 0;
        border: solid #{math.div($simple-step-height, 2)}px transparent;
        border-top-color: $devui-brand-foil;
        border-right-color: $devui-brand-foil;
        border-bottom-color: $devui-brand-foil;
      }

      &::after {
        content: '';
        width: 0;
        height: 0;
        position: absolute;
        right: -#{$simple-step-height}px;
        top: 0;
        border: solid #{math.div($simple-step-height, 2)}px transparent;
        border-left-color: $devui-brand-foil;
      }

      &.active {
        background-color: $devui-brand;
        color: $devui-light-text;

        &::before {
          border-top-color: $devui-brand;
          border-right-color: $devui-brand;
          border-bottom-color: $devui-brand;
        }

        &::after {
          border-left-color: $devui-brand;
        }
      }

      &.finished {
        background-color: $devui-success;
        color: $devui-light-text;

        &::before {
          border-top-color: $devui-success;
          border-right-color: $devui-success;
          border-bottom-color: $devui-success;
        }

        &::after {
          border-left-color: $devui-success;
        }
      }
    }
  }
}
